# Makefile for NETCONF project
#  
#   src/subsys directory

############### SOURCE PROFILE ##############################

SUBDIR_NM=subsys
SUBDIR_CPP=

############### TARGET PROFILE ##############################

TARGET=$(TBASE)/$(SUBDIR_NM)
BIN_INST=$(TBASE)/bin
REAL_INST=$(DESTDIR)$(PREFIX)/sbin
PROG=netconf-subsystem


##################### LIBRARIES ########################

# The order of these LIBS matters!
#
# If the linker can't find external symbols you know should
# be there and you get an Unresolved External error 
#   file foo : unresolved external to bar
# Then put the library that contains foo BEFORE the one
# that contains bar. 

LIBS = -lncx -lxml2 -lz -lm

############## MAKE RULES #################################
ifdef DEVELOPER
all:
else
all: subsys
endif  # DEVELOPER

#################### PLATFORM DEFINITIONS ############
include ../platform/platform.profile


################ DEPENDENCIES #########################
# depend rule must be included after the 'all' make rule

include ../platform/platform.profile.depend


clean:
	rm -f $(OBJS) $(BIN_INST)/$(PROG)


superclean:
	rm -f *~ *.D dependencies $(OBJS) $(BIN_INST)/$(PROG)

# needs to be done by root
install:
ifndef DEVELOPER
	mkdir -p $(REAL_INST)
	install $(OWNER) $(GRP) $(BIN_INST)/$(PROG) $(REAL_INST)
endif

uninstall:
	rm -f  $(REAL_INST)/$(PROG)

distclean: superclean

# this real rule keeps make from deleting the $(OBJS) as
# intermediate files
subsys: $(OBJS)
	$(LINK) $(CFLAGS) $(LFLAGS) $(OBJS) -o $(BIN_INST)/$(PROG) $(LPATH) $(FPATH) $(LIBS)


.PHONY: subsys

# prevent the make program from choking on all the symbols
# that get generated from autogenerated make rules
.NOEXPORT:

include ./dependencies
